/*
 * @lc app=leetcode.cn id=412 lang=javascript
 *
 * [412] Fizz Buzz
 */

// @lc code=start
/**
 * @param {number} n
 * @return {string[]}
 */
var fizzBuzz = function(n) {
    let result = []
    for (let index = 0; index < n; index++) {
        let threeFlag = (index + 1) % 3 === 0
        let fiveFlag = (index + 1) % 5 === 0
        if (threeFlag && fiveFlag) {
            result.push('FizzBuzz')
        } else if (threeFlag) {
            result.push('Fizz')
        } else if (fiveFlag) {
            result.push('Buzz')
        } else {
            result.push(index + 1 + '')
        }
    }
    return result
};
// @lc code=end

